package org.example.outputformat;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

/**
 *  自定义输出文件、
 * @ClassName LogOutPutFormat
 * @Author 小坏
 * @Date 2021/7/23、11:02
 * @Version 1.0
 */
public class LogOutPutFormat extends FileOutputFormat<Text, NullWritable> {
    @Override
    public RecordWriter<Text, NullWritable> getRecordWriter(TaskAttemptContext job) throws IOException, InterruptedException {

            //返回值是RecordWriter<Text, NullWritable>  那就去创建一个
        LogRecordWriter lrw =new LogRecordWriter(job);
        return lrw;
    }
}
